#include <iostream>
#include <string>
#include "TCPServer.hpp"
#include "Command.hpp"

void Usage(const std::string &name)
{
    std::cout << "usage: " << name << " + port" << std::endl;
}

int main(int argc, char *args[])
{
    if (argc != 2)
    {
        Usage(args[0]);
        exit(USAGE_ERROR);
    }
    in_port_t port = std::stoi(args[1]);

    Command command;
    auto message_handler = std::bind(&Command::Excute, &command, std::placeholders::_1, std::placeholders::_2, std::placeholders::_3);

    TCPServer tcp(port, message_handler);
    tcp.Run();
    return 0;
}